<?php

namespace App\Vilidate\playlet;

/**
 * user控制器下的验证规则类
 */
class AppletCouponController
{
    public $index = ['rule'=>[], 'msg'=>[]];


    public $delete = ['rule'=>[], 'msg'=>[]];

    public $create = [
        'rule'=>[
            'name' => 'required|string|max:15',
            'applet_id' => 'required',
            'discount_type' => 'required|integer',
            'valid_type' =>'required|integer',
            'valid_duration' =>'required|integer',
            'receive_time' => 'required|array',
            'stock_number' => 'required|integer',
            'consume_desc' => 'required|string|max:15',
        ],
        'msg'=>[
            'name.required' => '优惠券不能为空',
            'name.string' => '优惠券名称应为字符串',
            'name.max' => '优惠券名称不能超过15字',
            'applet_id.required' => '小程序不能为空',
            'discount_type.required' => '券类型不能为空',
            'discount_type.integer' => '券类型应该为整数',
            'valid_type.required' => '用户领券后有效期类型不能为空',
            'valid_type.integer' => '用户领券后有效期类型应该为整数',
            'valid_duration.required' => '用户领取的的有效时长不能为空',
            'valid_duration.integer' => '用户领取的的有效时长应该为秒',
            'receive_time.required' => '券生效时间不能为空',
            'receive_time.array' => '生效时间应该为数组',
            'stock_number.required' => '库存不能为空',
            'stock_number.integer' => '库存应该为整数',
            'consume_desc.required' => '使用须知不能为空',
            'consume_desc.string' => '使用须知应为字符串',
            'consume_desc.max' => '使用须知不能超过15字',
        ]
    ];

    public $update = [
        'rule'=>[
            'name' => 'required|string|max:15',
            'applet_id' => 'required',
            'valid_type' =>'required|integer',
            'valid_duration' =>'required|integer',
            'receive_time' => 'required|array',
            'consume_desc' => 'required|string|max:15',
        ],
        'msg'=>[
            'name.required' => '优惠券不能为空',
            'name.string' => '优惠券名称应为字符串',
            'name.max' => '优惠券名称不能超过15字',
            'applet_id.required' => '小程序不能为空',
            'valid_type.required' => '用户领券后有效期类型不能为空',
            'valid_type.integer' => '用户领券后有效期类型应该为整数',
            'valid_duration.required' => '用户领取的的有效时长不能为空',
            'valid_duration.integer' => '用户领取的的有效时长应该为整数',
            'receive_time.required' => '券生效时间不能为空',
            'receive_time.array' => '生效时间应该为数组',
            'consume_desc.required' => '使用须知不能为空',
            'consume_desc.string' => '使用须知应为字符串',
            'consume_desc.max' => '使用须知不能超过15字',
        ]
    ];

    public $updateMetaStock = [
        'rule'=>[
            'add_number' => 'required|integer',
        ],
        'msg'=>[
            'add_number.required' => '库存不能为空',
            'add_number.integer' => '库存应该为整数',
        ]
    ];

    public $updateMetaStatus= [
        'rule'=>[
            'status' => 'required|integer',
        ],
        'msg'=>[
            'status.required' => '状态不能为空',
            'status.integer' => '状态应该为整数',
        ]
    ];
}